/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package dbs;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author tae
 */
@Entity
@Table(name = "user")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "User.findAll", query = "SELECT u FROM User u"),
    @NamedQuery(name = "User.findByFacebookId", query = "SELECT u FROM User u WHERE u.facebookId = :facebookId"),
    @NamedQuery(name = "User.findByName", query = "SELECT u FROM User u WHERE u.name = :name")})
public class User implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "FacebookId")
    private Long facebookId;
    @Size(max = 45)
    @Column(name = "Name")
    private String name;
    @Size(max = 500)
    @Column(name = "GCM_key")
    private String gcmkey;

    public User() {
    }

    public User(Long facebookId) {
        this.facebookId = facebookId;
    }

    public Long getFacebookId() {
        return facebookId;
    }

    public void setFacebookId(Long facebookId) {
        this.facebookId = facebookId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getGCMkey() {
        return gcmkey;
    }

    public void setGCMkey(String gCMkey) {
        this.gcmkey = gCMkey;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (facebookId != null ? facebookId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof User)) {
            return false;
        }
        User other = (User) object;
        if ((this.facebookId == null && other.facebookId != null) || (this.facebookId != null && !this.facebookId.equals(other.facebookId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "dbs.User[ facebookId=" + facebookId + " ]";
    }
    
}
